<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Unicode Aware Regex Iterators</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../../index.html" title="Boost.Regex 7.0.1">
<link rel="up" href="../icu.html" title="Working With Unicode and ICU String Types">
<link rel="prev" href="unicode_algo.html" title="Unicode Regular Expression Algorithms">
<link rel="next" href="../mfc_strings.html" title="Using Boost Regex With MFC Strings">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="unicode_algo.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../icu.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../mfc_strings.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="boost_regex.ref.non_std_strings.icu.unicode_iter"></a><a class="link" href="unicode_iter.html" title="Unicode Aware Regex Iterators">Unicode
          Aware Regex Iterators</a>
</h5></div></div></div>
<h5>
<a name="boost_regex.ref.non_std_strings.icu.unicode_iter.h0"></a>
            <span class="phrase"><a name="boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_iterator"></a></span><a class="link" href="unicode_iter.html#boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_iterator">u32regex_iterator</a>
          </h5>
<p>
            Type <code class="computeroutput"><span class="identifier">u32regex_iterator</span></code>
            is in all respects the same as <a class="link" href="../../regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> except that since
            the regular expression type is always <code class="computeroutput"><span class="identifier">u32regex</span></code>
            it only takes one template parameter (the iterator type). It also calls
            <code class="computeroutput"><span class="identifier">u32regex_search</span></code> internally,
            allowing it to interface correctly with UTF-8, UTF-16, and UTF-32 data:
          </p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">u32regex_iterator</span>
<span class="special">{</span>
   <span class="comment">// for members see regex_iterator</span>
<span class="special">};</span>

<span class="keyword">typedef</span> <span class="identifier">u32regex_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*&gt;</span>     <span class="identifier">utf8regex_iterator</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">u32regex_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*&gt;</span>    <span class="identifier">utf16regex_iterator</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">u32regex_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar32</span><span class="special">*&gt;</span>  <span class="identifier">utf32regex_iterator</span><span class="special">;</span>
</pre>
<p>
            In order to simplify the construction of a <code class="computeroutput"><span class="identifier">u32regex_iterator</span></code>
            from a string, there are a series of non-member helper functions called
            make_u32regex_iterator:
          </p>
<pre class="programlisting"><span class="identifier">u32regex_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
                          <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
                          <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="identifier">u32regex_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
                          <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
                          <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="identifier">u32regex_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
                          <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
                          <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
<span class="identifier">u32regex_iterator</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;::</span><span class="identifier">const_iterator</span><span class="special">&gt;</span>
   <span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">,</span>
                          <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
                          <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="identifier">u32regex_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">,</span>
                          <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
                          <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>
</pre>
<p>
            Each of these overloads returns an iterator that enumerates all occurrences
            of expression <span class="emphasis"><em>e</em></span>, in text <span class="emphasis"><em>s</em></span>,
            using match_flags <span class="emphasis"><em>m</em></span>.
          </p>
<p>
            Example: search for international currency symbols, along with their
            associated numeric value:
          </p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">enumerate_currencies</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="identifier">text</span><span class="special">)</span>
<span class="special">{</span>
   <span class="comment">// enumerate and print all the currency symbols, along</span>
   <span class="comment">// with any associated numeric values:</span>
   <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">re</span> <span class="special">=</span>
      <span class="string">"([[:Sc:]][[:Cf:][:Cc:][:Z*:]]*)?"</span>
      <span class="string">"([[:Nd:]]+(?:[[:Po:]][[:Nd:]]+)?)?"</span>
      <span class="string">"(?(1)"</span>
         <span class="string">"|(?(2)"</span>
            <span class="string">"[[:Cf:][:Cc:][:Z*:]]*"</span>
         <span class="string">")"</span>
         <span class="string">"[[:Sc:]]"</span>
      <span class="string">")"</span><span class="special">;</span>
   <span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex</span><span class="special">(</span><span class="identifier">re</span><span class="special">);</span>
   <span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex_iterator</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">&gt;</span>
         <span class="identifier">i</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex_iterator</span><span class="special">(</span><span class="identifier">text</span><span class="special">,</span> <span class="identifier">r</span><span class="special">)),</span> <span class="identifier">j</span><span class="special">;</span>
   <span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
   <span class="special">{</span>
      <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="special">(*</span><span class="identifier">i</span><span class="special">)[</span><span class="number">0</span><span class="special">]</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
      <span class="special">++</span><span class="identifier">i</span><span class="special">;</span>
   <span class="special">}</span>
<span class="special">}</span>
</pre>
<p>
            Calling
          </p>
<pre class="programlisting">enumerate_currencies(" $100.23 or £198.12 ");</pre>
<p>
            Yields the output:
          </p>
<pre class="programlisting">$100.23
£198.12
</pre>
<p>
            Provided of course that the input is encoded as UTF-8.
          </p>
<h5>
<a name="boost_regex.ref.non_std_strings.icu.unicode_iter.h1"></a>
            <span class="phrase"><a name="boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_token_iterator"></a></span><a class="link" href="unicode_iter.html#boost_regex.ref.non_std_strings.icu.unicode_iter.u32regex_token_iterator">u32regex_token_iterator</a>
          </h5>
<p>
            Type <code class="computeroutput"><span class="identifier">u32regex_token_iterator</span></code>
            is in all respects the same as <a class="link" href="../../regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a> except
            that since the regular expression type is always <code class="computeroutput"><span class="identifier">u32regex</span></code>
            it only takes one template parameter (the iterator type). It also calls
            <code class="computeroutput"><span class="identifier">u32regex_search</span></code> internally,
            allowing it to interface correctly with UTF-8, UTF-16, and UTF-32 data:
          </p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BidirectionalIterator</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">u32regex_token_iterator</span>
<span class="special">{</span>
   <span class="comment">// for members see regex_token_iterator</span>
<span class="special">};</span>

<span class="keyword">typedef</span> <span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*&gt;</span>     <span class="identifier">utf8regex_token_iterator</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*&gt;</span>    <span class="identifier">utf16regex_token_iterator</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar32</span><span class="special">*&gt;</span>  <span class="identifier">utf32regex_token_iterator</span><span class="special">;</span>
</pre>
<p>
            In order to simplify the construction of a <code class="computeroutput"><span class="identifier">u32regex_token_iterator</span></code>
            from a string, there are a series of non-member helper functions called
            <code class="computeroutput"><span class="identifier">make_u32regex_token_iterator</span></code>:
          </p>
<pre class="programlisting"><span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">int</span> <span class="identifier">sub</span><span class="special">,</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">int</span> <span class="identifier">sub</span><span class="special">,</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">int</span> <span class="identifier">sub</span><span class="special">,</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;::</span><span class="identifier">const_iterator</span><span class="special">&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">s</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">int</span> <span class="identifier">sub</span><span class="special">,</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">int</span> <span class="identifier">sub</span><span class="special">,</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>
</pre>
<p>
            Each of these overloads returns an iterator that enumerates all occurrences
            of marked sub-expression sub in regular expression <span class="emphasis"><em>e</em></span>,
            found in text <span class="emphasis"><em>s</em></span>, using match_flags <span class="emphasis"><em>m</em></span>.
          </p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">&gt;</span>
<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&amp;</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">&gt;</span>
<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&amp;</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">&gt;</span>
<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&amp;</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">&gt;</span>
<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;::</span><span class="identifier">const_iterator</span><span class="special">&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">p</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&amp;</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="keyword">template</span> <span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">&gt;</span>
<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&amp;</span><span class="identifier">submatch</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>
</pre>
<p>
            Each of these overloads returns an iterator that enumerates one sub-expression
            for each submatch in regular expression <span class="emphasis"><em>e</em></span>, found
            in text <span class="emphasis"><em>s</em></span>, using match_flags <span class="emphasis"><em>m</em></span>.
          </p>
<pre class="programlisting"><span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">char</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;&amp;</span> <span class="identifier">submatch</span><span class="special">,</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="keyword">wchar_t</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;&amp;</span> <span class="identifier">submatch</span><span class="special">,</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*</span> <span class="identifier">p</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;&amp;</span> <span class="identifier">submatch</span><span class="special">,</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;::</span><span class="identifier">const_iterator</span><span class="special">&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special">&lt;</span><span class="identifier">charT</span><span class="special">,</span> <span class="identifier">Traits</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;&amp;</span> <span class="identifier">p</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;&amp;</span> <span class="identifier">submatch</span><span class="special">,</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>

<span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">UChar</span><span class="special">*&gt;</span>
   <span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span>
         <span class="keyword">const</span> <span class="identifier">UnicodeString</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">u32regex</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">,</span>
         <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;&amp;</span> <span class="identifier">submatch</span><span class="special">,</span>
         <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">m</span> <span class="special">=</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>
</pre>
<p>
            Each of these overloads returns an iterator that enumerates one sub-expression
            for each submatch in regular expression <span class="emphasis"><em>e</em></span>, found
            in text <span class="emphasis"><em>s</em></span>, using match_flags <span class="emphasis"><em>m</em></span>.
          </p>
<p>
            Example: search for international currency symbols, along with their
            associated numeric value:
          </p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">enumerate_currencies2</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="identifier">text</span><span class="special">)</span>
<span class="special">{</span>
   <span class="comment">// enumerate and print all the currency symbols, along</span>
   <span class="comment">// with any associated numeric values:</span>
   <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">re</span> <span class="special">=</span>
      <span class="string">"([[:Sc:]][[:Cf:][:Cc:][:Z*:]]*)?"</span>
      <span class="string">"([[:Nd:]]+(?:[[:Po:]][[:Nd:]]+)?)?"</span>
      <span class="string">"(?(1)"</span>
         <span class="string">"|(?(2)"</span>
            <span class="string">"[[:Cf:][:Cc:][:Z*:]]*"</span>
         <span class="string">")"</span>
         <span class="string">"[[:Sc:]]"</span>
      <span class="string">")"</span><span class="special">;</span>
   <span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex</span> <span class="identifier">r</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex</span><span class="special">(</span><span class="identifier">re</span><span class="special">);</span>
   <span class="identifier">boost</span><span class="special">::</span><span class="identifier">u32regex_token_iterator</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">&gt;</span>
      <span class="identifier">i</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_u32regex_token_iterator</span><span class="special">(</span><span class="identifier">text</span><span class="special">,</span> <span class="identifier">r</span><span class="special">,</span> <span class="number">1</span><span class="special">)),</span> <span class="identifier">j</span><span class="special">;</span>
   <span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
   <span class="special">{</span>
      <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="special">*</span><span class="identifier">i</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
      <span class="special">++</span><span class="identifier">i</span><span class="special">;</span>
   <span class="special">}</span>
<span class="special">}</span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="unicode_algo.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../icu.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../mfc_strings.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
